// 令牌util

const localStorageKey = "my-nav-token"

// 获取 token
export function getToken() {
    return localStorage.getItem(localStorageKey)
}

// 保存token
export function setToken(token: string) {
    localStorage.setItem(localStorageKey, token)
}

// 移除全部token
export function removeAllToken() {
    localStorage.removeItem(localStorageKey)
}

// 请求头设置token
export function headersToken(headers: Headers) {
    headers.set("Authorization", "Bearer " + localStorage.getItem(localStorageKey))
}